package com.joint.cloud.subject4_1_1.helloworld.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@Configuration
@EnableSwagger2
public class SwaggerConfig {

    public static final String SWAGGER_TITLE = "云际项目API";
    public static final String SWAGGER_DESC = "云际项目";

    @Bean
    public Docket documentation() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(metadata())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.joint.cloud.subject4_1_1.helloworld.controller"))
                .build();
    }

    private ApiInfo metadata() {
        return new ApiInfoBuilder().title(SWAGGER_TITLE)
                .description(SWAGGER_DESC)
                .version("1.0").build();
    }

}
